home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TGCBOR20.ARJ / INTROPAK.COM / MOVEIMAG.C < prev    next >
Text File  |  1991-04-06  |  1KB  |  59 lines

  1.  
  2.   /* -- This program illustrates how an image can be hidden then displayed  */
  3.   /* -- again at a different screen location.  */
  4.  
  5. #include "teglsys.h"
  6.  
  7. imagestkptr  fs; 
  8.     unsigned         i, dx, dy;
  9.  
  10.  
  11.  
  12.  
  13. void main(void)
  14. {
  15.  
  16.  
  17.   easytegl();
  18.   easyout();
  19.  
  20.  
  21.   pushimage(1,1,50,50);
  22.   shadowbox(1,1,50,50);
  23.   fs = stackptr;
  24.  
  25.   i = 20000;   /* -- counter  */
  26.   dx = 0;   /* -- simple delta for the frame  */
  27.   dy = 0;
  28.   do {
  29.      i = i - 1;
  30.      if (i == 100)
  31.     hideimage(fs);   /* -- just hides the image, doesn't dispose  */
  32.      if (i == 0)
  33.     {
  34.           dx = dx + 3;
  35.           dy = dy + 2;
  36.  
  37.             /* -- check for screen boundaries  */
  38.       if (((dx > getmaxx() - 60) | (dy > getmaxy() - 60)))
  39.             {
  40.               dx = 1;
  41.               dy = 1;
  42.             }
  43.             /* -- show image places the image at the new location. If you want  */
  44.             /* -- to display it at it's orginal location use the imagestackptr  */
  45.             /* -- x and y, they are the same as when it was hidden.  */
  46.       showimage(fs,dx,dy);
  47.       i = 4000;
  48.     }
  49.   }  while (mouse_buttons == 0);
  50.  
  51.   if (i <= 100)
  52.     showimage(fs,fs->x,fs->y);
  53.  
  54.   teglsupervisor();
  55. }
  56.  
  57.  
  58.  
  59.